import {Route,Redirect} from 'react-router-dom';
import React from 'react';

function Myroute({component:Component, path:Path}) {
    return(
        <Route path={Path} render={ props =>(
            localStorage.getItem('token') ?
                (<Component/>) :
                (<Redirect to={'/'}/>))}
        />
    )
}

export default Myroute;
